package com.deepwiki.domain.enums;

/**
 * 仓库状态枚举
 */
public enum WarehouseStatus {
    /**
     * 待处理
     */
    PENDING(0, "待处理"),

    /**
     * 处理中
     */
    PROCESSING(1, "处理中"),

    /**
     * 已完成
     */
    COMPLETED(2, "已完成"),

    /**
     * 已取消
     */
    CANCELED(3, "已取消"),

    /**
     * 未授权
     */
    UNAUTHORIZED(4, "未授权"),

    /**
     * 已失败
     */
    FAILED(99, "已失败");

    private final int code;
    private final String description;

    WarehouseStatus(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static WarehouseStatus fromCode(int code) {
        for (WarehouseStatus status : values()) {
            if (status.code == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown status code: " + code);
    }

    @Override
    public String toString() {
        return description;
    }
} 